#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "Usart.h"
#include "Wdg.h"
#include "HC_SR04.h"
#include "OLED.h"

float Length_mm,Length_cm,length_cmf;

int main(void)
{
	Delay_ms(100);
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
	HC_SR04Init();
	OLED_Init();
	OLED_ShowString(1,1,"Length:");
	OLED_ShowChar(1,11,'.');
	OLED_ShowString(1,14,"cm");
	while(1)
	{
		uint16_t Length_mm = Sonar();
		uint16_t Length_cm = Length_mm / 10;
		uint16_t length_cmf = Length_mm % 10;
		OLED_ShowNum(1,8,Length_cm,3);
		OLED_ShowNum(1,12,length_cmf,1);
		Delay_ms(100);
	}
}


